{% extends "layouts/signed_out.html" %}

{% block title %}登录{% endblock %}

{% block content %}
<style type ="text/css">
  body{background: url("/static/images/backlogin.jpg") center center no-repeat;}
</style>
<body>
<div class="fixed-width-page">
  <div class="bg-white tiled">
    {% with messages = get_flashed_messages() %}
      {% if messages %}
        {% for message in messages %}
          <div class="alert alert-danger" role="alert" data-test="ErrorMessage">{{ message }}</div>
        {% endfor %}
      {% endif %}
    {% endwith %}

    {% if show_google_openid %}
      <a href="{{ google_auth_url }}" class="login-button btn btn-default btn-block">
        <img src={{ asset_url("static/images/google_logo.svg") }}>
        使用Google账户登录
      </a>
    {% endif %}

    {% if show_saml_login %}
      <a href="{{ url_for('saml_auth.sp_initiated', org_slug=org_slug, next=next) }}" class="login-button btn btn-default btn-block">SAML认证</a>
    {% endif %}

    {% if show_remote_user_login %}
      <a href="{{ url_for('remote_user_auth.login', org_slug=org_slug, next=next) }}" class="login-button btn btn-default btn-block">远程用户登录</a>
    {% endif %}

    {% if show_ldap_login %}
      <a href="{{ url_for('ldap_auth.login', org_slug=org_slug, next=next) }}" class="login-button btn btn-default btn-block">LDAP/SSO认证</a>
    {% endif %}

    {% if show_password_login %}
    {% if show_google_openid or show_saml_login or show_remote_user_login or show_ldap_login %}
      <hr>
    {% endif %}

    {% if show_sms_login != '' %}
    <div class="tabs">
      <div class="tab-2">
        <label for="tab2-1"><b>账户登录</b></label>
        <input id="tab2-1" name="tabs-two" type="radio" checked="checked">
        {% endif %}
        <div>
          <form role="form" method="post">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
            <div class="form-group">
              <label for="inputEmail">{{ username_prompt or '用户编码或电子邮箱' }}</label>
              <input type="text" class="form-control" id="inputEmail" name="email" value="{{email}}" data-test="Email">
            </div>
            <div class="form-group">
              <label for="inputPassword">登录密码</label>
              <input type="password" class="form-control" id="inputPassword" name="password" value="{{password}}" data-test="Password">
            </div>
            <div>
              <input type="checkbox" id="inputRemember" name="remember">
              <label for="inputRemember" style="vertical-align: middle;">下次自动登录</label>
            </div>
      
            <button type="submit" name="pwdlogin" style="height: 40px; font-size: 18px;" class="btn btn-primary btn-block m-t-25">登录</button>
          </form>
          {% if not hide_forgot_password %}
            <div class="m-t-25">
              <a href="{{ base_url }}forgot">忘记密码</a>
            </div>
          {% endif %}
        </div>
      </div>

      {% if show_sms_login != '' %}
      <div class="tab-2" style="height: 40px">
        <label for="tab2-2"><b>手机登录</b></label>
        {% if mobile == '' %}
          <input id="tab2-2" name="tabs-two" type="radio">
        {% else %}
          <input id="tab2-2" name="tabs-two" type="radio" checked="checked">
        {% endif %}
        <div>
          <form role="form" method="post">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
            <input type="hidden" name="remember" value="off">
            <div class="form-group">
              <label for="inputMobile">手机号</label>
              <input type="text" class="form-control" id="inputMobile" name="mobile" value="{{mobile}}" data-test="Mobile">
            </div>
            <div class="form-group">
              <label for="inputSms">短信验证码：</label>
              <input type="text" id="inputSms" name="sms" value="" data-test="Sms">
              <button type="submit" name="smssend">发送手机验证码</button>
              <br/><br/>
            </div>

            <button type="submit" name="smslogin" style="height: 40px; font-size: 18px;" class="btn btn-primary btn-block m-t-25">登录</button>
          </form>
        </div>
      </div>
    </div>
    {% endif %}

    {% endif %}
  </div>
</div>
{% endblock %}
